package com.markhsiu.minimq.client.producer;

import com.markhsiu.minimq.client.AbstractClientContainer;
import com.markhsiu.minimq.message.Message;
import com.markhsiu.minimq.message.Result;
import com.markhsiu.minimq.message.constant.MessageCmdEnum;
import com.markhsiu.minimq.message.constant.MessageSourceEnum;

/**
 * 生产者客户端
 * Created by Mark Hsiu on 2017/2/8.
 */
public class Producer extends AbstractClientContainer{
	
 
	public Producer(){}
	
 
	/**
	 * 发送消息到broker
	 * @param message
	 * @return
	 */
	public Result send(Message message){
		message.setCmd(MessageCmdEnum.NEW);
		message.setSource(MessageSourceEnum.PRODUCER);;
        message.setTarget(MessageSourceEnum.BROKER);
        message.setTimestamp(System.currentTimeMillis());
		return getClient().send(message);
	}


	@Override
	public void init() {}
	

}
